package com.longxi.tianjintianbao.ui.activity.assetscheck;

import android.content.Intent;
import android.support.v4.view.ViewPager;

import com.baiiu.filter.DropDownMenu;
import com.flyco.tablayout.SlidingTabLayout;
import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.assetscheck.AssetsContentAtPresenter;
import com.longxi.tianjintianbao.ui.view.assetscheck.IAssetsContentAtView;
//import com.yyydjk.library.DropDownMenu;

import butterknife.BindView;

public class AssetsContentActivity extends BaseActivity<IAssetsContentAtView, AssetsContentAtPresenter> implements IAssetsContentAtView {

    private String TAG = "AssetsContentActivity";

    @BindView(R.id.dropDownMenu)
    DropDownMenu mDropDownMenu;
    @BindView(R.id.tabLayout)
    SlidingTabLayout mTabLayout;
    @BindView(R.id.mFilterContentView)
    ViewPager mViewPager;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_assets_content;
    }

    @Override
    public void initData() {
        super.initData();
        mPresenter.setBar();
    }

    @Override
    public void initListener() {
        super.initListener();
        mIvRight.setOnClickListener(v -> mPresenter.scan());
    }

    @Override
    protected AssetsContentAtPresenter createPresenter() {
        return new AssetsContentAtPresenter(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    public DropDownMenu getDropDownMenu() {
        return mDropDownMenu;
    }

    @Override
    public SlidingTabLayout getTabLayout() {
        return mTabLayout;
    }

    @Override
    public ViewPager getViewPager() {
        return mViewPager;
    }

    @Override
    public void onBackPressed() {
        //退出activity前关闭菜单
        if (getDropDownMenu().isShowing()) {
            getDropDownMenu().close();
        } else {
            super.onBackPressed();
        }
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(RESULT_OK != resultCode){
            return;
        }
        mPresenter.onActivityResult(requestCode, data);
    }
}
